package com.stormragetech.sylwanas.persistence;

import lombok.extern.log4j.Log4j2;

import java.io.File;
import java.io.IOException;

/**
 * description: //TODO
 *
 * @author: Xue Bin
 * @version: 1.0.0-SNAPSHOT
 */
@Log4j2
public abstract class FilePersistable {

    public File makeFile(String path, String name) {
        File p = new File(path);
        if (!p.exists() || !p.isDirectory()) {
            p.mkdirs();
        }
        File f = new File(p, name);
        if (!f.exists() || !f.isFile()) {
            try {
                boolean b = f.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return f;
    }

}
